package com.yxq.mdt.app.modules.socialcontact.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalBean;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalStateBean;
import com.yxq.mdt.app.modules.socialcontact.bean.AttentionManAndDynamicBean;
import com.yxq.mdt.app.modules.socialcontact.bean.BrowseListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GroupTopicListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialStateGiveListLikeBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SubscribersListBean;
import com.yxq.mdt.app.modules.socialcontact.model.MainSocialContactModel;
import com.yxq.mdt.app.net.ApiModel;

public class MainSocialPgaeInfoPresenter extends BasePresenter<MainSocialPageInfoContract.View, MainSocialContactModel> implements MainSocialPageInfoContract.Presenter {
    /**
     * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
     *
     * @param rootView
     * @param model
     */
    public MainSocialPgaeInfoPresenter(MainSocialPageInfoContract.View rootView, MainSocialContactModel model) {
        super(rootView, model);
    }


    @Override
    public void getPageInfoList(String pageNum, String pageSize, String topicId) {
        mBaseModel.getPageInfo(pageNum, pageSize, topicId, new ApiModel.CommonCallback<MainPersonalStateBean>() {
            @Override
            public void onSuccess(MainPersonalStateBean mainPersonalBean) {
                mRootView.onLoadPageInfoSuccess(mainPersonalBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadPageInfoFailed();
            }
        });
    }

    @Override
    public void getTopicById(String id) {
        mBaseModel.getTopicById(id, new ApiModel.CommonCallback<GroupTopicListBean>() {
            @Override
            public void onSuccess(GroupTopicListBean mainPersonalBean) {
                mRootView.onLoadTopicByIdSuccess(mainPersonalBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadTopicByIdFailed();
            }
        });
    }

    @Override
    public void setTopicFavour(String topicId, String type) {
        mBaseModel.saveGsTopicFavour(topicId, type, new ApiModel.CommonCallback<String>() {
            @Override
            public void onSuccess(String s) {
                mRootView.onLoadTopicFavorSuccess(s);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadTopicFavorFailed();
            }
        });
    }

    @Override
    public void getGiveList(String topicId, String pageSize, String pageNum) {
        mBaseModel.getGiveList(topicId, pageSize, pageNum, new ApiModel.CommonCallback<SocialStateGiveListLikeBean>() {
            @Override
            public void onSuccess(SocialStateGiveListLikeBean socialStateGiveListLikeBean) {
                mRootView.onLoadGiveSuccess(socialStateGiveListLikeBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadGiveFailed();
            }
        });
    }

    @Override
    public void getBrowseListList(String id, String pageSize, String pageNum) {
        mBaseModel.getBrowseList(id, pageSize, pageNum, new ApiModel.CommonCallback<BrowseListBean>() {
            @Override
            public void onSuccess(BrowseListBean socialStateGiveListLikeBean) {
                mRootView.onLoadBrowseListSuccess(socialStateGiveListLikeBean);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadBrowseListFailed();
            }
        });
    }
}
